import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import axios from "axios";

Vue.config.productionTip = false
Vue.use(ElementUI)
axios.defaults.baseURL = 'http://localhost:9020'

axios.interceptors.request.use(config => {
  console.log("store",store)
  console.log("store.state",store.state)
  console.log("store.state.token",store.state.token)
  if (store.state.token) {
    config.headers['Authorization'] = store.state.token
  }
  return config
}, error => {
  return Promise.reject(error)
})


new Vue({
  router,
  store,
  render: function (h) { return h(App) }
}).$mount('#app')
